package com.cmcc.qx.common;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.LinkedHashMap;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.cmcc.qx.util.JdbcProperties;
import com.cmcc.qx.util.ToHtmlUtil;

public class StartSer extends QuartzJobBean {

	protected void executeInternal(JobExecutionContext arg0)
			throws JobExecutionException {
		// 在服务启动的时候，去生成head.jsp文件
		try {
			Class.forName(JdbcProperties.driverClassName);
			Connection con = DriverManager.getConnection(JdbcProperties.url,
					JdbcProperties.username, JdbcProperties.password);
			Statement stmt = con.createStatement();
			//查询导航sql
			String sql = "select * from xqobject_type where obj_type = 'navigation' ORDER BY seq";
			ResultSet rs = stmt.executeQuery(sql);
			Constants.navMap = new LinkedHashMap<String, String>();
			while (rs.next()) {
				Constants.navMap.put(rs.getString("obj_num"), rs.getString("obj_name"));
			}
			ToHtmlUtil.addHeadJsp(Constants.navMap);
			
			
			//生成base.html 文件
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
}
